package com.openbravo.pos.printer.javapos;

import com.openbravo.pos.printer.DeviceDisplay;
import com.openbravo.pos.printer.DeviceDisplayBase;
import com.openbravo.pos.printer.DeviceDisplayImpl;
import com.openbravo.pos.printer.TicketPrinterException;
import javax.swing.JComponent;
import jpos.JposException;
import jpos.LineDisplay;

public class DeviceDisplayJavaPOS
  implements DeviceDisplay, DeviceDisplayImpl
{
  private String m_sName;
  private LineDisplay m_ld;
  private DeviceDisplayBase m_displaylines;

  public DeviceDisplayJavaPOS(String paramString)
    throws TicketPrinterException
  {
    this.m_sName = paramString;
    this.m_ld = new LineDisplay();
    try
    {
      this.m_ld.open(this.m_sName);
      this.m_ld.claim(10000);
      this.m_ld.setDeviceEnabled(true);
    }
    catch (JposException localJposException)
    {
      throw new TicketPrinterException(localJposException.getMessage(), localJposException);
    }
    this.m_displaylines = new DeviceDisplayBase(this);
  }

  public String getDisplayName()
  {
    return this.m_sName;
  }

  public String getDisplayDescription()
  {
    return null;
  }

  public JComponent getDisplayComponent()
  {
    return null;
  }

  public void writeVisor(int paramInt, String paramString1, String paramString2)
  {
    this.m_displaylines.writeVisor(paramInt, paramString1, paramString2);
  }

  public void writeVisor(String paramString1, String paramString2)
  {
    this.m_displaylines.writeVisor(paramString1, paramString2);
  }

  public void clearVisor()
  {
    this.m_displaylines.clearVisor();
  }

  public void repaintLines()
  {
    try
    {
      this.m_ld.displayTextAt(0, 0, this.m_displaylines.getLine1(), 0);
      this.m_ld.displayTextAt(1, 0, this.m_displaylines.getLine2(), 0);
    }
    catch (JposException localJposException)
    {
    }
  }

  public void finalize()
    throws Throwable
  {
    this.m_ld.setDeviceEnabled(false);
    this.m_ld.release();
    this.m_ld.close();
    super.finalize();
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.printer.javapos.DeviceDisplayJavaPOS
 * JD-Core Version:    0.6.0
 */